// 下载并引入mysql
let mysql = require("mysql");

// 创建连接，并连接数据库
let con = mysql.createConnection({
    host: "localhost",
    port: 3306,
    user: "root",
    password: "root",
    database: "tenwork"
})
con.connect()


function DB(sql) {

    let p = new Promise((resolve, reject) => {
        // 先查询此账号是否可注册
        con.query(sql, (err, result) => {
            resolve([err, result])
        })
    })

    return p
}

module.exports=DB